/**
 * 
 * @param {*} data 转换数据
 */
function dataFormation(data){
    // let type = data instanceof Array
    // return new Promise(async(resolve) => {
    //     if(!type) resolve(JSON.parse(data))
    //     for(let i=0;i<data.length;i++){
    //         data[i] = JSON.parse(data[i])
    //     }
    //     resolve(data)
    // })
    return data
    
}
const filterNull = (obj)=> {
    for (let key in obj) {
        if (obj[key] === null || obj[key] == '' || obj[key].disabled) {
            delete obj[key]
        }
        if (typeof(obj[key]) === 'string') {
            obj[key] = obj[key].trim();
        } else if (toType(obj[key]) === 'object') {
            obj[key] = filterNull(obj[key]);
        } else if (toType(obj[key]) === 'array') {
            obj[key] = filterNull(obj[key]);
        }
    }
    return obj;
}
export function toType (obj) {
    return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
}
export {dataFormation,filterNull}